package com.reverie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.reverie.entity.Cart;
import com.reverie.mapper.CartMapper;
import com.reverie.service.ICartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Rui.Zhou
 * @since 2024-02-03
 */
@Service
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements ICartService {

    @Override
    public boolean removeByGoodsId(Integer goodsId) {
        if(goodsId == null){
            return false;
        }
        QueryWrapper<Cart> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("goods_id", goodsId);
        return remove(queryWrapper);
    }
}
